package com.ficus.road.maintain.core.model;

import com.fasterxml.jackson.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Author hao.zhou1
 * @Since 2021/4/8 下午3:07
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class Confirmation {
    @JsonProperty("status")
    private ConfirmationStatus status;
    @JsonProperty("confirmTime")
    private Long confirmTime;

    public enum ConfirmationStatus {
        /* 待确认　*/
        TO_BE_CONFIRMED("TO_BE_CONFIRMED"),
        /* 正确预警　*/
        CORRECT("CORRECT"),
        /* 不正确预警　*/
        INCORRECT("INCORRECT"),
        /* 删除 */
        DELETE("DELETE");

        private String value;

        ConfirmationStatus(String value) {
            this.value = value;
        }

        @JsonCreator
        public static ConfirmationStatus fromValue(String value) {
            for (ConfirmationStatus b : ConfirmationStatus.values()) {
                if (b.value.equals(value)) {
                    return b;
                }
            }
            throw new IllegalArgumentException("Unexpected value '" + value + "'");
        }

        @Override
        @JsonValue
        public String toString() {
            return String.valueOf(value);
        }
    }
}
